package com.gears_software.sxdc.dccx.data.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;

import com.gears_software.sxdc.dccx.data.model.CPOrderDetailModel;
import com.gears_software.sxdc.dccx.data.model.RidingInformation;
import com.gears_software.sxdc.dccx.ui.view.TripInformationItemView;
import com.gears_software.sxdc.dccx.ui.view.TripInformationItemView_;
import com.gears_software.sxdc.dccx.ui.view.TripInformationNewItemView;
import com.gears_software.sxdc.dccx.ui.view.TripInformationNewItemView_;

import java.util.List;

/**
 * Created by SunMuran on 2017/7/29.
 */

public  class TripInformationAdapter extends BaseAdapter{
    private Context context;
    private List<CPOrderDetailModel> detailModels;

    public TripInformationAdapter(Context context, List<CPOrderDetailModel> detailModels) {
        this.context = context;
        this.detailModels = detailModels;
    }

    @Override
    public int getCount() {
        return detailModels.size();
    }

    @Override
    public CPOrderDetailModel getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TripInformationNewItemView itemView = null;
        if (convertView == null) {
            itemView = TripInformationNewItemView_.build(context);
        } else {
            itemView = (TripInformationNewItemView) convertView;
        }

        itemView.bind(detailModels.get(position));

        return itemView;
    }
}
